package com.example.springboottest.thymeleaf.controller;


import com.example.springboottest.student.service.StuService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("stuThymeleaf")
public class StuThymeleafController {
    @Autowired
    @Qualifier("stuJdbcService")
    private StuService stuService;

    @ApiOperation(value = "查询所有学生")
    @RequestMapping(value = "/stuList.api", method = {RequestMethod.POST, RequestMethod.GET})
    public String stuList(Model model) {
        model.addAttribute("list", stuService.doFindALl());
        return "stu/stuList";
    }

    @ApiOperation(value = "跨域例子")
    @GetMapping("/crossOrigin.api")
    public String crossOrigin() {
        return "stu/crossOrigin";
    }
}
